<?php
function user_reg_anonymous_user($uuid,$uname=''){
	global $zeit,$cfg_reg;
	if ($uname==''){
		$uname = 'xx的手机';
	}
	$sql = "INSERT INTO u_account
	(`uuid` ,`is_anonym` ,`reg_zeit`, uname,level,exp,credits)
	VALUES
	('$uuid', 1, $zeit,'$uname',0,0,$cfg_reg[credits] )";
	mysql_x_query($sql);
	$uid = mysql_insert_id();
	$account = array('uid'=>$uid,
					 'uuid'=>$uuid,
					 'is_anonym'=>1);
	
	$sql = "INSERT INTO u_user_extend
	(uid,json_data,probability_counter)
	VALUES
	($uid,'{}','{}')";
	mysql_x_query($sql);
	return $account;
}

//-------------unfinished-----------//

function isexist_uname($username){
	$conn = db_connect();
	$sql = "SELECT uid FROM u_user WHERE uname = '$username'";
	$result = mysql_x_query($sql);
	if(mysql_num_rows($result) > 0 ) {
		return true;
	}
	else {
		return false;
	}
}

function check_pp_uid_exists($pp_uid){
    global $zone_id;
    $sql = "SELECT uid FROM u_user WHERE pp_uid='$pp_uid' AND zone_id = $zone_id AND DOA<>-1";
    $rst = mysql_w_query($sql);
    if( mysql_num_rows($rst)>0){
            return true;
    }else{
            return false;
    }
}
?>